package swingExtended.customTextPane;

import java.awt.Color;

/**
 *
 * @author g1wshimu
 */
public class ErrorTextPane extends SimpleTextPane {

    public ErrorTextPane() {
        this.setColor(Color.RED);
    }
    
    /**
     * Prints an error message to the screen using the default compatibleFont and color
     * for errors. Prints the localized message of the given exception on
     * a separate line.
     * 
     * @param msg
     * @param ex 
     */
    public void exceptionPrintln(String msg, Exception ex) {
        String exMsg = ex.getMessage();
        if (exMsg != null) {
            this.println(exMsg);
        }
        this.println(msg);
        /*
        for (StackTraceElement e : ex.getStackTrace()) {
            this.println(e.toString());
        }*/
        //ex.printStackTrace();
    }

    /**
     * Prints an error message to the screen using the default compatibleFont and color
     * for errors. Prints the localized message of the given error on a 
     * separate line.
     * 
     * @param msg
     * @param e 
     */
    public void errorPrintln(String msg, Error e) {
        this.println(msg);
        this.println(e.getMessage());
    }
}
